<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width initial-scale=1'>
    <title>热点资讯</title>

    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- Vue.js -->
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <!-- jQuery文件 在bootstrap.min.js之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <style>
        body {
            background-color: white;
            padding: 10px 10px;
        }

        .news-item {
            border-bottom: solid 1px gainsboro;
        }

        .lead {
            text-indent: 2rem;
        }

        .align-left {
            display: inline-block;
            width: 38%;
        }

        .align-right {
            display: inline-block;
            width: 60%;
        }

        .word-small {
            font-size: 1.5rem;
        }

        h4 {
            font-weight: bold;
        }
    </style>

</head>
<body>

<div id="app">
    <div class="news-item" v-for="hotNews in hotNewsList">
        <h4>{{hotNews.title}}</h4>
        <p class="lead word-small">{{hotNews.content}}</p>
        <p class="word-small">
            <span class="align-left">实时资讯</span>
            <span class="text-right align-right">时间：{{hotNews.updateTime}}</span>
        </p>
    </div>
</div>

<script>

    new Vue({
        el: '#app',
        data: {
            hotNewsList: []
        },
        methods: {
            loadHotNewsList: function () {
                var _this = this;
                $.get("/controller/hotNews/findLastestHotNewsList", function (data) {
                    if (data.code == "10000") {
                        for (var i in data.obj) {
                            _this.hotNewsList.push(data.obj[i]);
                        }
                    }
                });
                console.info(this.hotNewsList);
            }
        },
        mounted() {
            this.loadHotNewsList();
        }
    });

</script>

</body>
</html>